<!DOCTYPE html>
<html lang="en" xml:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>用户编辑</title>
    <link rel="stylesheet" href="/layui/css/layui.css">
</head>
<body>
<div class="layui-container" style="width:600px;">
    <form class="layui-form layui-form-pane" action="" lay-filter="userInfo">
        <input name="id" th:value="${entity.id}" hidden>
        <div class="layui-form-item">
            <label class="layui-form-label">账号</label>
            <div class="layui-input-block">
                <input type="username" th:value="${entity.username}" name="username" placeholder="请输入账号"
                       autocomplete="off"
                       class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-form-label ">姓名</div>
            <div class="layui-input-block">
                <input name="nickname" th:value="${entity.nickname}" placeholder="请输入姓名" autocomplete="off"
                       class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-form-label ">邮箱</div>
            <div class="layui-input-block">
                <input type="email" th:value="${entity.mail}" name="mail" placeholder="请输入邮箱" autocomplete="off"
                       class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-form-label ">手机号</div>
            <div class="layui-input-block">
                <input type="phone" th:value="${entity.phoneNumber}" name="phoneNumber" placeholder="请输入手机号" autocomplete="off"
                       class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button type="submit" class="layui-btn" lay-submit="" lay-filter="submit">保存</button>
            </div>
        </div>
    </form>
</div>
</body>

<script src="/layui/layui.js"></script>
<script src="/js/core.util.js"></script>
<script>
    layui.use(['jquery', 'form'], function () {
        var layer = layui.layer;
        var $ = layui.jquery;
        var form = layui.form;

        //监听提交
        form.on('submit(submit)', function (data) {
            CoreUtil.sendAjax("/study/user", JSON.stringify(data.field), function (res) {
                layer.msg(res.msg);
            }, "PUT", false);
            return false;
        });


    });
</script>
</html>